package com.ap.autobase.repository.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ap.autobase.domain.User;
import com.ap.autobase.repository.UserDao;

@Repository
@Transactional
public class UserDaoImpl extends GenericDaoImpl<User, Integer> implements
		UserDao {

	public User getUserWithLoginAndPassword(String username, String password) {
		Criteria cr = getSession().createCriteria(User.class, "user")
				.add(Restrictions.eq("username", username))
				.add(Restrictions.eq("password", password));
		return (User) cr.uniqueResult();
	}

}
